Dynomotion

Group: DynoMotion Message: 11151 From: develo_jon Date: 3/3/2015
Subject: KStep PWM for VFD

Tom,


I am struggling to make sense of the control of the above.


I am pretty sure it is a comprehension issue having tried another kflop.


The VFD supplies 5V, I put this into JP33 Pin5, and Ground from the VFD into Pin7.  But Pin 6 is reading 0V.


I have the code from usingkstep page:

FPGA(KAN_TRIG_REG)=4;  // Mux PWM0 to JP7 Pin5 IO 44 for KSTEP

SetBitDirection(44,1);  // define bit as an output

FPGA(IO_PWMS_PRESCALE) = 46;        // divide clock by 46 (1.4 KHz)

FPGA(IO_PWMS+1) = 1;                // Enable


I have found two PWM commands that seem like they might be relevant, WritePWM(a,b) and PWMa=b.


The range for these commands would seem to be -255 -> +255 so I was hoping that PWM0=0 would result in something between 0 and 5V as an output on pin 6.


PWM0=255 should be give closer to 5V and PWM0=-255 should give closer to 0V.


This does not seem to be the case, I get a solid, stable and reliable 0V on pin 6.


Once I have some control of the VFD speed.. I wish to use CSS so would like to use the Spindle.c programs but none of these seemed to want to help my comprehension either as none of them refer to PWM.


I look forward as always to your response and being put on the right track :)



Many thanks,


Jon







Group: DynoMotion Message: 11152 From: Tom Kerekes Date: 3/3/2015
Subject: Re: KStep PWM for VFD
Hi Jon,

To set the duty cycle for a KFLOP PWM it is necessary to write the FPGA register.  The range fro 0 to 100% is 0 to 255 PWM counts

For example:

FPGA(IO_PWMS+1) = 128;                // Set the duty cycle to 50%

See also the C Programs\KStep\KStepPWMCorrected.c example.

Regards
TK

Group: DynoMotion Message: 11153 From: develo_jon Date: 3/3/2015
Subject: Re: KStep PWM for VFD
Excellent.  Even with your deliberate typo I now have 2.5V.


FPGA(IO_PWMS+1) = 1;  //for enable

FPGA(IO_PWMS) = 128; // gives 2.5V


Thanks Tom.


Jon


Group: DynoMotion Message: 11156 From: Tom Kerekes Date: 3/3/2015
Subject: Re: KStep PWM for VFD
Hi Jon,

Yeah I was testing you :}

Regards
TK